package cn.baimo.controller;

import cn.baimo.pojo.Doctor;
import cn.baimo.pojo.Hospital;
import cn.baimo.service.DoctorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
@RequestMapping("/doctor")
public class DoctorController  {
    @Autowired
    private DoctorService doctorService;
    @RequestMapping("select")
    public String selectDoctor(Model model, Doctor doctor,String diName, String hName){
        Hospital hospital=new Hospital();
        hospital.setName(hName);
        List<Doctor> doctors = doctorService.selectDoctorsByDoctor(doctor, diName, hospital);
        model.addAttribute("doctors",doctors);
        return "/pages/doctor_list.jsp";
    }
}
